/**
 * 基础表单服务
 *
 * @author nanye
 * @version 1.0.0, 2017/11/28
 * @see DemoController
 * @since 巡查计划
 */

(function (app, ng) {
    'use strict';

    /**
     * 注册服务
     */
    app.service('basicFormService', Service);

    /**
     * 依赖项
     */
    Service.$inject = ['iResource', 'dialogs','$http'];

    //下拉框数据
    var selects = [{id:1,name:"option1"},
                  {id:2,name:"option2"},
                  {id:3,name:"option3"},
                  {id:4,name:"option4"},
                  {id:5,name:"option5"}];
    //多选下拉框数据
    var selectCascade = [{id:1,name:"湖北省"},
                        {id:2,name:"湖南省"},
                        {id:3,name:"安徽省"},
                        {id:4,name:"江西省"},
                        {id:5,name:"河南省"}];
    //城市信息
    var selectCity = [{id:1,city:[{id:11,name:"武汉市"},{id:12,name:"黄石市"},{id:13,name:"黄冈市"}]},
                     {id:2,city:[{id:21,name:"长沙市"},{id:22,name:"岳阳市"},{id:23,name:"张家界"}]},
                     {id:3,city:[{id:31,name:"合肥市"},{id:32,name:"阜阳市"},{id:33,name:"安庆市"}]},
                     {id:4,city:[{id:41,name:"南昌市"},{id:42,name:"九江市"},{id:43,name:"景德镇"}]},
                     {id:5,city:[{id:51,name:"郑州市"},{id:52,name:"商丘市"},{id:53,name:"洛阳市"}]}];
    
    
    //下拉框ID
    var selectId = ['#selectRadio','#selectMultiple'];
    /**
     * 服务
     * @constructor
     */
    function Service(iResource, dialogs,$http) {
        // 初始化
        var s = this;
        
        //下拉框数据
        this.selects = selects;
        //多选下拉框数据
        this.selectCascade = selectCascade;
        //城市信息
        this.selectCity = selectCity;
        //下拉框ID
        this.selectId = selectId;
        
        this.search = function(param){
        	return $http.post(
                    ISS.getPath('/demos/search'),
                    param,
                    {contentType: 'json'}
                ).then(function (resp) {
                    return resp.data;
                });
        }
        
    }
})(iApp.module(), window.angular);